/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package quizzempire.view;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.Observable;
import java.util.Observer;
import quizzempire.model.IModel;

/**
 *
 * @author Victor
 */
public class About extends javax.swing.JDialog implements Observer {

    /**
     * Creates new form About
     */
    IModel model; 
    
    public About(IModel model) {
        initComponents();
        
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        this.setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);
        lbLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/quizzempire/resources/gamerlogo.png")));
        lbCredits.setText(model.getAbout());
        this.model = model;
        model.addObserver(this);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        DIFFICULTY = new java.awt.Label();
        lbCredits = new javax.swing.JLabel();
        btCloseAbout = new javax.swing.JButton();
        lbLogo = new javax.swing.JLabel();

        setMinimumSize(new java.awt.Dimension(500, 375));
        setModalityType(java.awt.Dialog.ModalityType.DOCUMENT_MODAL);
        setPreferredSize(new java.awt.Dimension(500, 375));
        setResizable(false);

        DIFFICULTY.setAlignment(java.awt.Label.CENTER);
        DIFFICULTY.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
        DIFFICULTY.setText("CREDITS");

        lbCredits.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lbCredits.setText("creditos");
        lbCredits.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        lbCredits.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

        btCloseAbout.setText("CLOSE");
        btCloseAbout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btCloseAboutActionPerformed(evt);
            }
        });

        lbLogo.setText("LOGO");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(172, 172, 172)
                .addComponent(DIFFICULTY, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(lbCredits, javax.swing.GroupLayout.PREFERRED_SIZE, 459, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(214, 214, 214)
                .addComponent(btCloseAbout)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(lbLogo, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(137, 137, 137))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lbLogo, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(DIFFICULTY, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbCredits, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btCloseAbout)
                .addContainerGap(42, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btCloseAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCloseAboutActionPerformed
        setVisible(false);
        dispose();
    }//GEN-LAST:event_btCloseAboutActionPerformed



    public void update(Observable o , Object arg){
    //TODO
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private java.awt.Label DIFFICULTY;
    private javax.swing.JButton btCloseAbout;
    private javax.swing.JLabel lbCredits;
    private javax.swing.JLabel lbLogo;
    // End of variables declaration//GEN-END:variables
}
